<template>
	<view class="container">
		<view class=" ">
			<view>
				<uni-calendar class="uni-calendar--hook" :selected="info.selected" :showMonth="false" @change="change" @monthSwitch="monthSwitch" />
			</view>
			<view class="p-12">
				<view class="flex-x-between bg-white radius-12 mb-12" v-for="(item,index) in list" :key="index">
						<view class="flex-y-center">
							<image :src="$utils.getPic(item.imgs)" class="w-60 h-60 radius-4 pr-4"></image>
						 <view class=" w-180 line-text-space">{{item.title}}</view>	
						</view>
						<view class="flex-y-center cl-999 pr-4">
							<image src="/static/image/shiz.png" class="w-15 h-15 pr-4 "></image> <view class="fs-12">{{dataJson.time}}</view>
						</view>
					</view>
				</view>
			</view>
			
	</view>
</template>

<script>
import { log } from 'util';
	export default {
		data() {
			return {
				// tab数据
			info: {
				lunar: true,
				range: true,
				insert: false,
				selected: []
			},
			list:[],
			dataJson:{
				time:'2025-03-21',
			},
			nowtime:''
			}
		},
		onReady() {
		},
		onLoad() {
			// setTimeout(() => {
			// 	this.info.date = getDate(new Date(), -30).fullDate;
			// 	this.info.startDate = getDate(new Date(), -60).fullDate;
			// 	this.info.endDate = getDate(new Date(), 30).fullDate;
			// 	this.info.selected = [];
			// }, 2000);
			// console.log("this.info.date",this.info.date);
			this.dataJson.time = this.currentDate();
			this.getlist();
		},
		methods: {
		  currentDate() {
			  const year = new Date().getFullYear();
			  const month = new Date().getMonth() + 1;
			  const day = new Date().getDate();
			  
			  // 使用padStart方法来补零
			  const formattedDate = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
			  
			  return formattedDate;
			},
			getlist(){
				this.list =[]
				this.$rqt.getReservationByTime(this.dataJson).then((res) => {
					if (res.code == 200) {
						this.list = res.data
						uni.hideLoading()
					}
					uni.hideLoading()
				})
			},
			change(e) {
				console.log("e",e);
				this.nowTime = e.fulldate
				this.dataJson.time = e.fulldate
				this.getlist()
				// 模拟动态打卡
				// if (this.info.selected.length > 5) return;
				// this.info.selected.push({
				// 	date: e.fulldate,
				// 	info: '打卡'
				// });
			},
			// monthSwitch(e) {
			// 	console.log('monthSwitchs 返回:', e);
			// 	this.dataJson.time = e.fulldate
				
			// }
		
		}
	}
</script>

<style>
	.container {
	}
	.index_bg{
		background: url(../../static/image/bg.jpg) no-repeat;
		/* height: 400rpx; */
		
	}
	::v-deep .uni-calendar-item__weeks-box-item, ::v-deep .uni-calendar__header, ::v-deep .uni-calendar__weeks-day{
		height: 35px;
	}
	::v-deep .uni-calendar-item--isDay{
		line-height: 16px;
	}
	::v-deep .uni-calendar-item--checked{
		line-height: 16px;
	}
	
	::v-deep .uni-calendar-item--checked, ::v-deep .uni-calendar-item--isDay{
		background-color:rgb(184, 42, 39);
		border-radius: 8px;
	}
	::v-deep .uni-calendar-item--isDay-text{
		/* color: rgb(184, 42, 39); */
	}
</style>
